use std::{fs::{self, File}, path::Path};


pub fn path_exist(dir : &str) -> bool {
    let path = Path::new(dir);
    if path.exists() {
        return true;
    }
    return false;
}

pub fn path_is_dir(dir : &str) -> bool {
    let path = Path::new(dir);
    if path.exists() && path.is_dir() {
        return true;
    }
    return false;
}

pub fn path_is_file(dir : &str) -> bool {
    let path = Path::new(dir);
    if path.exists() && path.is_file() {
        return true;
    }
    return false;
}

pub fn create_dir(dir : &str){
    let path = Path::new(dir);
    if !path.exists() {
        let result = fs::create_dir_all(dir);
        match result {
            Err(e) => {
                println!("failed crate dir {}",dir);
            },
            _ => {}
        }
    }
}